package com.xcjw.com.Utils;

import android.content.Context;
import android.widget.Toast;

/**
 * Created by 惠普计算机 on 2016.07.12.
 */
public class ToastUtils {
    public static Toast toast;

    public static void shorttoast(Context context, String msg) {
        if (toast == null) {
            toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        }
        toast.setText(msg);
        toast.show();
    }
    public static void longtoast(Context context, String msg) {
        if (toast == null) {
            toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        }
        toast.setText(msg);
        toast.show();
    }

    public static void longtoast(Context context, CharSequence text, int i) {
        if (toast == null) {
            toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
        }
        toast.setText(text);
        toast.show();
    }
    public static void cancle() {
        if (toast != null){
            toast.cancel();
        }
    }

}
